package io.renren.common.constants.enums;

import lombok.Getter;

import java.util.Arrays;

/**
 * 支付模块类型枚举
 */
@Getter
public enum UserFundModeType implements EnumValue{
    LIANREN_MAKE_CUSTOM_PAY(1, "恋人定制支付"),
    LIANREN_MAKE_CUSTOM_INCOME(2, "恋人定制收入"),
    ZHIYIN_MAKE_CUSTOM_PAY(3, "知音定制支付"),
    ZHIYIN_MAKE_CUSTOM_INCOME(4, "知音定制收入"),
    ;

    /**值*/
    private int value;
    /**描述*/
    private String desc;

    UserFundModeType(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    /**
     * 获取枚举
     *
     * @return
     */
    public static UserFundModeType getByCode(int code) {
        return Arrays.stream(values()).filter(e -> e.getValue() == code).findFirst().orElse(LIANREN_MAKE_CUSTOM_PAY);
    }

    @Override
    public int value() {
        return this.value;
    }

    @Override
    public String toString() {
        return this.value+"";
    }
}
